/**
 *
 */
package org.tio.sitexxx.im.common.bs;

import java.io.Serializable;

import org.tio.sitexxx.service.model.main.ChatRecord;
import org.tio.sitexxx.service.model.main.ChatRecordP2p;
import org.tio.sitexxx.service.vo.SimpleUser;

/**
 * 
 * @author tanyaowu 
 * 2016年9月12日 下午3:09:08
 */
public class P2PChatNtf extends BaseResp {

	public static class ChatItem implements Serializable {

		private static final long serialVersionUID = -5833359720274808335L;

		private String	mid;
		private Long	t;
		private String	c;									//聊天内容
		private Byte	ct	= ChatRecord.ContentType.TEXT;	//contentType 1、普通文本消息，2、超链接卡片消息，3、文件，4、音频，5、视频
		private Integer	uid;
		private Integer	touid;

		public static ChatItem fromChatRecord(ChatRecordP2p chatRecordP2p) {
			ChatItem ret = new ChatItem();
			ret.setC(chatRecordP2p.getText());
			ret.setCt(chatRecordP2p.getContenttype());
			ret.setMid(chatRecordP2p.getId() + "");
			ret.setT(chatRecordP2p.getTime().getTime());
			ret.setTouid(chatRecordP2p.getTouid());
			ret.setUid(chatRecordP2p.getUid());
			return ret;
		}

		public String getMid() {
			return mid;
		}

		public void setMid(String mid) {
			this.mid = mid;
		}

		public Long getT() {
			return t;
		}

		public void setT(Long t) {
			this.t = t;
		}

		public String getC() {
			return c;
		}

		public void setC(String c) {
			this.c = c;
		}

		public Byte getCt() {
			return ct;
		}

		public void setCt(Byte ct) {
			this.ct = ct;
		}

		public Integer getUid() {
			return uid;
		}

		public void setUid(Integer uid) {
			this.uid = uid;
		}

		public Integer getTouid() {
			return touid;
		}

		public void setTouid(Integer touid) {
			this.touid = touid;
		}
	}

	private SimpleUser to = null;

	private SimpleUser from = null;

	private ChatItem[] items = null;
	
	/**
	 * 消息模式。1：用户查询，服务器响应， 2：对方发送消息，服务器推送
	 */
	private Byte mode = (byte)1;


	private static final long serialVersionUID = -2935567695412664238L;

	/**
	 * @param args
	 */
	public static void main(String[] args) {
	}

	public SimpleUser getTo() {
		return to;
	}

	public void setTo(SimpleUser to) {
		this.to = to;
	}

	public SimpleUser getFrom() {
		return from;
	}

	public void setFrom(SimpleUser from) {
		this.from = from;
	}

	public ChatItem[] getItems() {
		return items;
	}

	public void setItems(ChatItem[] items) {
		this.items = items;
	}

	public Byte getMode() {
		return mode;
	}

	public void setMode(Byte mode) {
		this.mode = mode;
	}

}
